<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>你好，地区账号</title>
  <script>
    if(/http:/.test(location.href)) location.href = location.href.replace(/http:/, 'https:')
  </script>
  <script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery"></script>
  <script src="__PUBLIC__/script/layer/layer.js"></script>
  <script src="__PUBLIC__/node_modules/datatables/media/js/jquery.dataTables.min.js"></script>
  <script src="__PUBLIC__/script/bootstrap-treeview-master/dist/bootstrap-treeview.min.js"></script>
  <script src="__PUBLIC__/script/tagEditor/jquery.tag-editor.min.js"></script>
  <script src="__PUBLIC__/script/tagEditor/jquery.caret.min.js"></script>
  <link rel="stylesheet" href="__PUBLIC__/style/base.css">
  <link rel="stylesheet" href="__PUBLIC__/script/tagEditor/jquery.tag-editor.css">
  <link rel="stylesheet" href="__PUBLIC__/script/bootstrap-treeview-master/dist/bootstrap-treeview.min.css">
  <link rel="stylesheet" href="__PUBLIC__/node_modules/bootstrap/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="__PUBLIC__/style/manage.css">
  <link rel="stylesheet" href="__PUBLIC__/style/manage_chanpin.css">
</head>
<body>
  <div class="container-fluid">
    <div class="row">
      <header class="col-xs-6 col-md-2 account_name"><img class='img-responsive' src="__PUBLIC__/images/logo_long.jpg" alt=""></header>
      <div class="col-xs-12 col-md-12">
        <div class="row">

          <!-- 左侧栏 -->
          <div class="col-md-2 manage_nav_box">
            <iframe src="{:U('nav_1')}?local=chanpin_m" frameborder="0" width="100%" style="height:35rem;"></iframe>
            <!-- 账号选项 -->
            <div class="account_option">
              <a href="{:U('index/update_passwd')}" class="pass_mod">修改密码</a>
              <a href="{:U('index/loginout')}" class="sign_out">退出登录</a>
            </div>
            <!-- end 账号选型 -->
          </div>
          <!-- end 左侧栏 -->

          <!-- 右主体  -->
          <div class="col-md-10 col-md-10 messageBox">

            <!-- 账号主体显示 -->
            <!-- <div class="account_name">xxx,您好</div> -->
            <!-- end 账号主体显示 -->


            <!-- begin 筛选区域 -->
            <div class="search_form col-xs-12">
                <div class="seach_text_input_box">
                  <!-- 搜索以下字符以替换搜索链接 -->
                  <!-- self.location = '__PUBLIC__/manage_diqu_chanpin.html?search=' + value -->
                  <form autocomplete="off" action="{:U('manage_diqu_chanpin')}" method="get" style='display:none;' id ='search_hidden_form'>  </form>
                      <input type="text" class="chanpin" name='search' form='search_hidden_form' placeholder="输入产品名称进行搜索">
                      <input type="submit"value='搜索' form='search_hidden_form'>
                  <!-- <div class="tag_swith off"><span class="off">筛选 <span>♂</span></span><span class="on">收起 <span>♀</span></span></div> -->
                </div>
            <!--     <div class="multi_row_tag_search">
                  <div class="tag_row">
                    <span class="tag_type">渠道类型：</span>
                    <span class="tag_content active"><a inori-data='银行'>银行</a></span>
                    <span class="tag_content"><a inori-data='消费金融'>消费金融</a></span>
                    <span class="tag_content"><a inori-data='小额'>小额</a></span>
                    <span class="tag_content"><a inori-data='其他'>其他</a></span>
                  </div>
                  <div class="tag_row">
                    <span class="tag_type">产品类型：</span>
                    <span class="tag_content"><a inori-data='房产抵押类'>房产抵押类</a></span>
                    <span class="tag_content"><a inori-data='房产信用类'>房产信用类</a></span>
                    <span class="tag_content"><a inori-data='工薪类'>工薪类</a></span>
                    <span class="tag_content"><a inori-data='其他'>其他</a></span>
                  </div>
                  <div class="tag_search_list"><textarea name="tag_list" id="tag_list" rows="1" class="tag_list"></textarea></div>
                </div> -->
              </div>
              <!-- end 筛选区域 -->

            <!-- begin  授权产品列表列表 -->
            <header>所有产品列表<a href="#" style="display:none;"><img id="add_local_frame" src="__PUBLIC__/images/neiye/u138.png" alt="u138" title="添加授权产品"></a><a href="{:U('Uploads/cp_push')}"><img id="download_chanpin" src="__PUBLIC__/images/neiye/u354.png" alt="u354" title="下载产品列表"></a></header>
            <!-- end 表头 -->

            <table class="messageBoxContent table table-striped table-bordered" id="main_table">
                <thead>
                  <tr>
                    <th class="authNo">序号</th>
                    <th class="authDate">发布时间</th>
                    <th class="authQuydaoType">渠道类型</th>
                    <th class="authChanpinType">产品类型</th>
                    <th class="authChanpinName">产品名称</th>
                    <th class="authChanpinShiyong">适用渠道</th>
                    <th class="authSetting">多选 <input type="checkbox" name="test" id="fuck" form='not_submit'></th>
                    <th class="authMore">操作</th>
                    <th>发布</th>
                  </tr>
                </thead>
                <tbody>
				<volist name="list" id="data">
					<tr>
                    <th class="authNo">{$key+1}</th>
                    <th class="authDate">{$data.timeda}</th>
                    <th class="authQuydaoType">{$data.dtypename|qudao_type}</th>
                    <th class="authChanpinType"><span>{$data.id|change_dalei}</span></th>
                    <th class="authChanpinName">{$data.name}</th>
                    <th class="authChanpinShiyong">{$data.qudaoname}</th>
                    <th class="authSetting"><input type="checkbox" name="id_arr[]" id="diqu_2" form="delete_form" value="{$data.id}"></th>
                    <th class="authMore"><a href="{:U('add_chanpin',array('dID'=>$data[id]))}">详情</a></th>
                    <th><a href="{:U('Wxauthorise/issue',array('gx_id'=>$data[id]))}"><if condition='$data.j_id eq 1'>产品已发布<elseif condition='$data.j_id eq 0'/>产品发布</if></a></th>
                  </tr>
				</volist>
                </tbody>

              </table>
            <!-- end 授权产品列表列表 -->

            <!-- begin 删除选项（表单） -->
            <div class="form">
              <form autocomplete="off" action="{:U('Wxauthorise/manage_diqu_del')}" id="delete_form" method='POST'>
                <input type="submit" value="删除所选" class="delete_all">
                <input type="reset" value="取消选择" class="reset_all">
              </form>
            </div>
            <!-- end 删除选项（表单） -->

            <!-- begin 分页 -->
            <div class="authPage">
                    <!-- 页面指示器 -->
                    <!-- <div class="pages">24/{$count}</div> -->
                    <!-- 分页列表 -->
                    <!-- <span class="number">...</span> -->
                    <div class="pageList">
                      {$page}
                    </div>
            </div>
            <!-- end 分页 -->

          </div>
          <!-- end 右主体 -->

        </div>
      </div>
    </div>
  </div>
  <script>
    $(document).ready(function() {
      $('#tag_list').tagEditor({
        clickDelete: true,
        initialTags: ['tag1', 'tag2', 'tag3'],
        placeholder: '请点选或输入标签，请点选或输入标签，点击空白处确认添加'
      });
      var proList = $('#main_table').DataTable({
        "paging": false,
        "info": false,
        "searching": false
      })
      $('.multi_row_tag_search').on('click', function (e) {
        var target = e.target
        var data = target.getAttribute('inori-data')
        if( data !== undefined && !target.parentElement.classList.contains('active')) {
          $('#tag_list').tagEditor('addTag',data, true)
          target.parentElement.classList.add('active')
          target.addEventListener('click', function (e) {
            e.target.parentElement.classList.remove('active')
            $('#tag_list').tagEditor('removeTag',e.target.getAttribute('inori-data'), true)
            e.stopPropagation()
          },{
            once: true
          })
          console.log(data)
        } else if (data !== undefined && target.parentElement.classList.contains('active')) {
          target.parentElement.classList.remove('active')
          $('#tag_list').tagEditor('removeTag', data, true)
          e.stopPropagation()
        }
      })
      $('.messageBoxContent thead .authSetting').on('click', function (event) {
        event.stopPropagation();Array.from($('.messageBoxContent input[type=\'checkbox\']')).forEach(function(val,index){val.checked = !val.checked})
      })
      // ajax 提交
      // $('.seach_text_input_box input[type=\'submit\']').on('click', function (e) {
      //   var value = $('.seach_text_input_box input[type=\'text\']').val()
      //   var searchTag = $('#tag_list').tagEditor('getTags')[0].tags
      //   if (value.length > 0) {
      //     self.location = '__PUBLIC__/manage_diqu_chanpin.html?search=' + value
      //   }
      //   //  else if (searchTag.length > 0) {
      //   //   var urlquery = searchTag.join('&')
      //   //   self.location = '__PUBLIC__/manage_diqu_chanpin?tag=' + urlquery
      //   // }
      // })
    })
    window.addEventListener('message', fromNav, false)
    function fromNav(event) {
      console.log(event.data.url)
      if (event.data.url.length && event.data.url.length > 1) {
        self.location = event.data.url
      }
    }
  </script>
</body>
</html>
